<%@ page import="myschool.dao.GradeDao" %>
<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="myschool.util.MybatisUtil" %>
<%@ page import="myschool.entity.Grade" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2023-04-06
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%@include file="/checkLogin.jsp"%>

<form action="doAddSubject.jsp" method="post">
  <%--  <label >编号:</label>
    <input type="number" id="id" name="id"/>--%>
    <label >课程名称:</label>
    <input type="text" id="subname" name="subname"/>
    <label >课程时间:</label>
    <input type="text" id="hour" name="hour"/>

    <p>
        <%
            SqlSession s= MybatisUtil.get();
            GradeDao dao=s.getMapper(GradeDao.class);
            List<Grade> grades = dao.findAll();
            MybatisUtil.close(s);
        %>
        <label >年级号：</label>
        <select id="gradeid" name="gradeid">
            <%
                for(Grade g:grades){
                    //out.print("<option")
            %>
            <option value="<%=g.getId()%>"><%=g.getGname()%></option>
            <%}%>
        </select>
    </p>
    <input type="submit" value="Add"/>
</form>
</body>
</html>
